package com.yc.demo.test02;

import com.google.gson.Gson;
import com.yc.demo.bean.Result;
import com.yc.demo.d0303.LoginServlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Date;

@WebServlet(name = "ExitServlet", value = "/exit.s")
public class ExitServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.getSession().setAttribute("endtime",new Date().getTime());
        Result result = new Result();
        result.setMsg("退出成功");
        response.getWriter().append(new Gson().toJson(result));
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
